package cn.thread.pool.dynamic.thread.pool.sdk.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author: xiaoxie
 * create: 2025-02-11 21:42
 * @BelongsProject: custom-dynamic-thread-pool
 * @BelongsPackage: cn.thread.pool.dynamic.thread.pool.sdk.config
 * description: redis配置
 */
@ConfigurationProperties(prefix ="dynamic.thread.pool.config", ignoreInvalidFields = true)
public class DynamicThreadPoolRedisProperties {
        /** 状态；open = 开启、close 关闭 */
        private boolean enable;
        /** redis host */
        private String host;
        /** redis port */
        private int port;
        /** 账密 */
        private String password;
        /** 设置连接池的大小，默认为64 */
        private int poolSize = 64;
        /** 设置连接池的最小空闲连接数，默认为10 */
        private int minIdleSize = 10;
        /** 设置连接的最大空闲时间（单位：毫秒），超过该时间的空闲连接将被关闭，默认为10000 */
        private int idleTimeout = 10000;
        /** 设置连接超时时间（单位：毫秒），默认为10000 */
        private int connectTimeout = 10000;
        /** 设置连接重试次数，默认为3 */
        private int retryAttempts = 3;
        /** 设置连接重试的间隔时间（单位：毫秒），默认为1000 */
        private int retryInterval = 1000;
        /** 设置定期检查连接是否可用的时间间隔（单位：毫秒），默认为0，表示不进行定期检查 */
        private int pingInterval = 0;
        /** 设置是否保持长连接，默认为true */
        private boolean keepAlive = true;

        public boolean isEnable() {
            return enable;
        }

        public void setEnable(boolean enable) {
            this.enable = enable;
        }

        public String getHost() {
            return host;
        }

        public void setHost(String host) {
            this.host = host;
        }

        public int getPort() {
            return port;
        }

        public void setPort(int port) {
            this.port = port;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public int getPoolSize() {
            return poolSize;
        }

        public void setPoolSize(int poolSize) {
            this.poolSize = poolSize;
        }

        public int getMinIdleSize() {
            return minIdleSize;
        }

        public void setMinIdleSize(int minIdleSize) {
            this.minIdleSize = minIdleSize;
        }

        public int getIdleTimeout() {
            return idleTimeout;
        }

        public void setIdleTimeout(int idleTimeout) {
            this.idleTimeout = idleTimeout;
        }

        public int getConnectTimeout() {
            return connectTimeout;
        }

        public void setConnectTimeout(int connectTimeout) {
            this.connectTimeout = connectTimeout;
        }

        public int getRetryAttempts() {
            return retryAttempts;
        }

        public void setRetryAttempts(int retryAttempts) {
            this.retryAttempts = retryAttempts;
        }

        public int getRetryInterval() {
            return retryInterval;
        }

        public void setRetryInterval(int retryInterval) {
            this.retryInterval = retryInterval;
        }

        public int getPingInterval() {
            return pingInterval;
        }

        public void setPingInterval(int pingInterval) {
            this.pingInterval = pingInterval;
        }

        public boolean isKeepAlive() {
            return keepAlive;
        }

        public void setKeepAlive(boolean keepAlive) {
            this.keepAlive = keepAlive;
        }

}

